package com.wangzhixuan.service;

import com.wangzhixuan.db.bean.Department;
import com.wangzhixuan.db.dao.DepartmentDao;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 *
 */
@Service
public class DepartmentService {

    @Autowired
    private DepartmentDao departmentDao;

    /**
     * Get department by departmentId
     *
     * @param departmentId
     * @return
     */
    public Department getDepartmentById(long departmentId) {
        Department department = departmentDao.getDepartmentById(departmentId);
        return department;
    }

    public Department getDepartmentByName(String name) {
        Department department = departmentDao.getDepartmentByName(name);
        return department;
    }

    public List<Department> getAllDepartment() {
        return departmentDao.getAllDepartment();
    }
    public List<Department> getBaseDepartment() {
        return departmentDao.getBaseDepartment();
    }
    public List<Department> getDepartmentsByParentId(long parentId) {
        return departmentDao.getDepartmentsByParentId(parentId);
    }

}
